#include<bits/stdc++.h>

using namespace std;
const int maxn = 1e6 + 500;
map<int,int> M;
int main() {
    int n = 120;//120=2^3 * 3^1 * 5^1
    int c = 2;
    while (c*c<=n) {
        while (n % c == 0) {
            M[c]++;
            n /= c;
        }
        c++;
    }
    if(n!=1){
        cout<<n;
        M[n]++;
    }
    int d=1;
    for(auto e:M){
        cout<<e.first<<"^"<<e.second<<endl;
        d*=(e.second+1);
    }
    cout<<d<<endl;//120的因子数
    return 0;
}